﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;


namespace Marmat.Forms
{
    [ToolboxItem(true)]
    [ToolboxBitmap(typeof(DevExpress.XtraEditors.TimeEdit))]
    public partial class TimeBox : EditControl
    {
        public TimeBox()
        {

            // 此调用是设计器所必需的。
            this.InitializeComponent();

            // 在 InitializeComponent() 调用之后添加任何初始化。
            this.BaseEdit = this.TimeEdit1;
        }

        public new Size Size
        {
            get => base.Size;
            set
            {
                if (value != default)
                    value.Height = this.Font.Height + 8;
                base.Size = value;
            }
        }

        /// <summary>
        /// 获取或设置编辑器的值。
        /// </summary>
        [DefaultValue(null)]
        public new DateTime Value
        {
            get
            {
                if (ReferenceEquals(base.Value, DBNull.Value))
                {
                    return default;
                }
                return Convert.ToDateTime(base.Value);
            }
            set => base.Value = value;
        }
    }
}